home *** CD-ROM | disk | FTP | other *** search
/ 100 Plus Great Games 2 / 100PLUSV2.BIN / games / SimpleFaro.dxr / case keeper_55_aaa.ls < prev    next >
Encoding:
Text File  |  2002-01-25  |  6.1 KB  |  170 lines

  1. property winMe, loseMe, spriteNum
  2. global deck, points, gPlayerBets, playerCredits, winSprite, loseSprite, losingDen, winningDen
  3.  
  4. on mouseEnter me
  5.   sprite(spriteNum).member = member(sprite(spriteNum).member.name & "2")
  6. end
  7.  
  8. on mouseLeave me
  9.   sprite(spriteNum).member = member(chars(sprite(spriteNum).member.name, 1, sprite(spriteNum).member.name.char.count - 1))
  10. end
  11.  
  12. on mouseDown me
  13.   puppetSound(3, member("deal card", "100GPak Generic SFX"))
  14.   loseMe = deck.mDrawCard(#top)
  15.   member(string(loseMe.pRank) && "text").char[3] = string(value(member(string(loseMe.pRank) && "text").char[3]) + 1)
  16.   deck.mRemoveFromDeck(loseMe)
  17.   loseSprite.member = member(loseMe.mGetImage())
  18.   puppetSound(3, member("deal card", "100GPak Generic SFX"))
  19.   winMe = deck.mDrawCard(#top)
  20.   member(string(winMe.pRank) && "text").char[1] = string(value(member(string(winMe.pRank) && "text").char[1]) + 1)
  21.   deck.mRemoveFromDeck(winMe)
  22.   winSprite.member = member(winMe.mGetImage())
  23.   repeat with i = gPlayerBets.count down to 1
  24.     if (gPlayerBets[i].pBet[#denomination] = loseMe.pRank) or (gPlayerBets[i].pBet[#denomination] = winMe.pRank) then
  25.       if gPlayerBets[i].pType = #single then
  26.         if loseMe.pRank <> winMe.pRank then
  27.           if ((gPlayerBets[i].pBet[#denomination] = loseMe.pRank) and (gPlayerBets[i].pBet[#outcome] = #lose)) or ((gPlayerBets[i].pBet[#denomination] = winMe.pRank) and (gPlayerBets[i].pBet[#outcome] = #win)) then
  28.             points = points + 100
  29.             playerCredits.text = string(points)
  30.           end if
  31.         else
  32.           if loseMe.pRank <> winMe.pRank then
  33.             if ((gPlayerBets[i].pBet[#denomination] = loseMe.pRank) and (gPlayerBets[i].pBet[#outcome] = #lose)) or ((gPlayerBets[i].pBet[#denomination] = winMe.pRank) and (gPlayerBets[i].pBet[#outcome] = #win)) then
  34.               points = points + 50
  35.               playerCredits.text = string(points)
  36.             end if
  37.           end if
  38.         end if
  39.         xtc = string(gPlayerBets.getPropAt(i))
  40.         xtc2 = value(chars(xtc, 2, xtc.char.count))
  41.         sprite(xtc2).chipPiece.loc = sprite(xtc2).chipPiece.ogLoc
  42.         sprite(xtc2).alreadyBetOn = 0
  43.         gPlayerBets[i].mRemoveBet(gPlayerBets.getPropAt(i))
  44.         updateStage()
  45.       end if
  46.       next repeat
  47.     end if
  48.     if gPlayerBets[i].pType = #set then
  49.       repeat with u in gPlayerBets[i].pBet[#denomination]
  50.         if (u = loseMe.pRank) or (u = winMe.pRank) then
  51.           if loseMe.pRank <> winMe.pRank then
  52.             put gPlayerBets[i].pBet[#outcome]
  53.             if ((u = loseMe.pRank) and (gPlayerBets[i].pBet[#outcome] = #lose)) or ((u = winMe.pRank) and (gPlayerBets[i].pBet[#outcome] = #win)) then
  54.               points = points + 100
  55.               playerCredits.text = string(points)
  56.             end if
  57.           else
  58.             if loseMe.pRank = winMe.pRank then
  59.               if ((u = loseMe.pRank) and (gPlayerBets[i].pBet[#outcome] = #lose)) or ((u = winMe.pRank) and (gPlayerBets[i].pBet[#outcome] = #win)) then
  60.                 points = points + 50
  61.                 playerCredits.text = string(points)
  62.               end if
  63.             end if
  64.           end if
  65.           xtc = string(gPlayerBets.getPropAt(i))
  66.           xtc2 = value(chars(xtc, 2, xtc.char.count))
  67.           sprite(xtc2).chipPiece.loc = sprite(xtc2).chipPiece.ogLoc
  68.           sprite(xtc2).alreadyBetOn = 0
  69.           gPlayerBets[i].mRemoveBet(gPlayerBets.getPropAt(i))
  70.           updateStage()
  71.         end if
  72.       end repeat
  73.       next repeat
  74.     end if
  75.     if gPlayerBets[i].pType = #special then
  76.       if gPlayerBets[i].pBet[#denomination] = #high then
  77.         if ((getValue(winMe.pRank) >= 7) and (gPlayerBets[i].pBet[#outcome] = #win)) or ((getValue(winMe.pRank) < 7) and (gPlayerBets[i].pBet[#outcome] = #lose)) then
  78.           points = points + 50
  79.           playerCredits.text = string(points)
  80.           updateStage()
  81.         else
  82.           points = points - 50
  83.           playerCredits.text = string(points)
  84.           updateStage()
  85.         end if
  86.         next repeat
  87.       end if
  88.       if gPlayerBets[i].pBet[#denomination] = #odd then
  89.         if (((getValue(winMe.pRank) mod 2) <> 0) and (gPlayerBets[i].pBet[#outcome] = #win)) or (((getValue(winMe.pRank) mod 2) = 0) and (gPlayerBets[i].pBet[#outcome] = #lose)) then
  90.           points = points + 50
  91.           playerCredits.text = string(points)
  92.           updateStage()
  93.         else
  94.           points = points - 50
  95.           playerCredits.text = string(points)
  96.           updateStage()
  97.         end if
  98.         updateStage()
  99.       end if
  100.     end if
  101.   end repeat
  102.   if points <= -100 then
  103.     go("game over")
  104.   end if
  105.   winMe = VOID
  106.   loseMe = VOID
  107.   if deck.mCountCards() = 1 then
  108.     repeat with i in ["ace", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "jack", "queen", "king"]
  109.       member(i && "text").text = "0/0"
  110.     end repeat
  111.     deck = VOID
  112.     deck = new(script("deck of cards"))
  113.     go(2)
  114.   end if
  115. end
  116.  
  117. on getValue arg
  118.   if arg = #ace then
  119.     return 1
  120.   else
  121.     if arg = #two then
  122.       return 2
  123.     else
  124.       if arg = #three then
  125.         return 3
  126.       else
  127.         if arg = #four then
  128.           return 4
  129.         else
  130.           if arg = #five then
  131.             return 5
  132.           else
  133.             if arg = #six then
  134.               return 6
  135.             else
  136.               if arg = #seven then
  137.                 return 7
  138.               else
  139.                 if arg = #eight then
  140.                   return 8
  141.                 else
  142.                   if arg = #nine then
  143.                     return 9
  144.                   else
  145.                     if arg = #ten then
  146.                       return 10
  147.                     else
  148.                       if arg = #jack then
  149.                         return 11
  150.                       else
  151.                         if arg = #queen then
  152.                           return 12
  153.                         else
  154.                           if arg = #king then
  155.                             return 13
  156.                           end if
  157.                         end if
  158.                       end if
  159.                     end if
  160.                   end if
  161.                 end if
  162.               end if
  163.             end if
  164.           end if
  165.         end if
  166.       end if
  167.     end if
  168.   end if
  169. end
  170.